import request from '@/utils/request'

export function getRefundUsableList(query) {
  let baseUrl = "/sale/refund"
  if(query != undefined){
    if(typeof query == "object"){
      console.log(query)
      if(query.hasOwnProperty('refundID')){
        query['refundID'] = parseInt(query['refundID'])
        if(isNaN(query['refundID']) == false){
          baseUrl = baseUrl+"-"+query['refundID']
        }
      }
    }
  }
  return request({
    url: baseUrl,
    method: 'get'
  })
}

export function getRefundList(query) {
  return request({
    url: '/sale/admin/refund/getList',
    method: 'post',
    data: query
  })
}
export function saveRefund(query) {
  return request({
    url: '/sale/admin/refund/save',
    method: 'post',
    data: query
  })
}

export function removeRefund(query) {
  return request({
    url: '/sale/admin/refund/remove',
    method: 'post',
    data: query
  })
}
export function getRefundDetail(query) {
  if(query != undefined){
    query = JSON.parse(JSON.stringify(query))
  }
  return request({
    url: '/sale/admin/refund/info/0',
    method: 'get',
    data: query
  })
}